module.exports = app => {
    const {STRING,DOUBLE} = app.Sequelize;
    // 默认情况下，sequelize将自动将所有传递的模型名称（define的第一个参数）转换为复数
    const Student = app.model.define('student',{
        // 自动生成ID
        name:STRING,
        achievement:DOUBLE,

    })
    Student.associate = function(){//所属那个班级，指向班级主键
        app.model.Student.belongsTo(app.model.Clazz,{//属于那个表
            foreignKey:'clazz_id',
            targetKey:'id',
        })
    }
    return Student;
}